package com.cat.iterator;

import java.util.List;

/**
 * @author cat
 * @version 2025/5/27 20:08
 * @description 具体迭代器角色类
 * @since JDK17
 */

public class StudentIteratorImpl implements StudentIterator {
    private List<Student> list;
    private int index = 0;


    public StudentIteratorImpl(List<Student> list) {
        this.list = list;
    }

    @Override
    public boolean hasNext() {
        return index < list.size();
    }

    @Override
    public Student next() {
        return list.get(index++);
    }
}
